<template>
    <div class="reportmian">
        <el-collapse v-model="activeNames">
            <el-collapse-item title="人事报表" name="1">
                <el-row class="divstyle">
                    <el-button type="primary" @click="onDialog('PersonnelSummary_dialog')">人事汇总报表</el-button>
                    <el-button type="primary" @click="onDialog('AttendanceSummaryReprot_dialog')">考情汇总报表</el-button>
                </el-row>
            </el-collapse-item>
            <el-collapse-item title="财务报表" name="2">
                <el-row class="divstyle">
                    <el-button type="primary" @click="onDialog('FinanceDetailReport_dialog')">财务汇总报表</el-button>
                    <el-button type="primary" @click="onDialog('FinanceCostReport_dialog')">财务成本报表</el-button>
                    <el-button type="primary" @click="onDialog('FinanceFlowWaterReport_dialog')">财务流水报表</el-button>
                    <el-button type="primary">财务工资报表</el-button>
                    <el-button type="primary" @click="onDialog('PersonLoanSumReport_dialog')">个人借款报表</el-button>
                </el-row>
            </el-collapse-item>
            <el-collapse-item title="项目报表" name="3">
                <el-row class="divstyle">
                    <el-button type="primary" @click="onDialog('ProjectCollectionReport_dialog')">项目回款台账</el-button>
                    <el-button type="primary" @click="onDialog('ProjectExpensesReport_dialog')">项目费用支出台账</el-button>
                    <el-button type="primary" @click="onDialog('ProjectLaborExpensesReport_dialog')">项目人工费支出台账
                    </el-button>
                    <el-button type="primary" @click="onDialog('ProjectGrossProfitReport_dialog')">项目毛利表</el-button>
                </el-row>
            </el-collapse-item>
            <el-collapse-item title="物资报表" name="4">
                <el-row class="divstyle">
                    <el-button type="primary" @click="onDialog('ApplyPurchaseReport_dialog')">申购汇总报表</el-button>
                    <el-button type="primary" @click="onDialog('PurchaseOrderReport_dialog')">采购汇总报表</el-button>
                    <el-button type="primary" @click="onDialog('InboundorderReport_dialog')">入库汇总报表</el-button>
                    <el-button type="primary" @click="onDialog('OutboundOrderReport_dialog')">出库汇总报表</el-button>
                </el-row>
            </el-collapse-item>
            <el-collapse-item title="车辆报表" name="5">
                <el-row class="divstyle">
                    <el-button type="primary" @click="onDialog('CarExpenseReport_dialog')">车辆费用台账</el-button>
                    <el-button type="primary" @click="onDialog('GasolineRecordReport_dialog')">油卡使用记录表</el-button>
                </el-row>
            </el-collapse-item>
        </el-collapse>

        <el-dialog fullscreen :visible.sync="FinanceDetailReport_dialog" title="财务汇总报表" :before-close="onClose">
            <FinanceDetailReport :all-project="AllProject" :all-department="AllDepartment"
                                 :all-customer="AllCustomer"></FinanceDetailReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="FinanceCostReport_dialog" title="财务成本报表" width="100%" :before-close="onClose">
            <FinanceCostReport :all-project="AllProject" :all-department="AllDepartment"></FinanceCostReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="FinanceFlowWaterReport_dialog" title="财务流水报表" width="100%" :before-close="onClose">
            <FinanceFlowWaterReport
                    :all-project="AllProject" :all-department="AllDepartment"
                    :all-customer="AllCustomer" :all-finance-bank-card="AllFinanceBankCard"></FinanceFlowWaterReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="PersonLoanSumReport_dialog" title="个人借款汇总" width="100%" :before-close="onClose">
            <PersonLoanSumReport :all-department="AllDepartment"></PersonLoanSumReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="ProjectCollectionReport_dialog" title="项目回账台账" width="100%" :before-close="onClose">
            <ProjectCollectionReport :all-department="AllDepartment" :all-project="AllProject"
                                     :all-customer="AllCustomer"></ProjectCollectionReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="ProjectExpensesReport_dialog" title="项目费用支出台账" width="100%" :before-close="onClose">
            <ProjectExpensesReport :all-project="AllProject"></ProjectExpensesReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="ProjectLaborExpensesReport_dialog" title="项目人工费支出台账" width="100%" :before-close="onClose">
            <ProjectLaborExpensesReport :all-project="AllProject"
                                        :all-customer="AllCustomer"></ProjectLaborExpensesReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="ProjectGrossProfitReport_dialog" title="项目毛利表" width="100%" :before-close="onClose">
            <ProjectGrossProfitReport :all-project="AllProject" :all-customer="AllCustomer"></ProjectGrossProfitReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="ApplyPurchaseReport_dialog" title="申购汇总报表" width="100%" :before-close="onClose">
            <ApplyPurchaseReport :all-project="AllProject" :all-department="AllDepartment"></ApplyPurchaseReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="PurchaseOrderReport_dialog" title="采购单汇总表" width="100%" :modal="false" :before-close="onClose">
            <PurchaseOrderReport :all-project="AllProject" :all-department="AllDepartment"
                                 :all-customer="AllCustomer"></PurchaseOrderReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="InboundorderReport_dialog" title="入库汇总报表" width="100%" :before-close="onClose">
            <InboundorderReport :all-project="AllProject" :all-department="AllDepartment"
                                :all-customer="AllCustomer"></InboundorderReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="OutboundOrderReport_dialog" title="出库汇总报表" width="100%" :before-close="onClose">
            <OutboundOrderReport :all-project="AllProject" :all-department="AllDepartment"
                                 :all-device-category="AllDeviceCategory"></OutboundOrderReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="CarExpenseReport_dialog" title="车辆费用台账" width="100%" :before-close="onClose">
            <CarExpenseReport :all-vehicle="AllVehicle"></CarExpenseReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="GasolineRecordReport_dialog" title="油卡使用记录表" width="100%" :before-close="onClose">
            <GasolineRecordReport :all-vehicle="AllVehicle" :all-project="AllProject"></GasolineRecordReport>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="PersonnelSummary_dialog" title="人事汇总报表" width="100%" :before-close="onClose">
            <PersonnelSummary></PersonnelSummary>
        </el-dialog>

        <el-dialog fullscreen :visible.sync="AttendanceSummaryReprot_dialog" title="考情汇总报表" width="100%" :before-close="onClose">
            <AttendanceSummaryReprot :all-department="AllDepartment"></AttendanceSummaryReprot>
        </el-dialog>

    </div>
</template>

<script>
    import * as publicjs from "../../../../public/Scriput/Public";
    import FinanceDetailReport from "./FinanceDetailReport";
    import FinanceCostReport from "./FinanceCostReport";
    import FinanceFlowWaterReport from "./FinanceFlowWaterReport";
    import PersonLoanSumReport from "./PersonLoanSumReport";
    import ProjectCollectionReport from "./ProjectCollectionReport";
    import ProjectExpensesReport from "./ProjectExpensesReport";
    import ProjectLaborExpensesReport from "./ProjectLaborExpensesReport";
    import ProjectGrossProfitReport from "./ProjectGrossProfitReport";
    import ApplyPurchaseReport from "./ApplyPurchaseReport";
    import PurchaseOrderReport from "./PurchaseOrderReport";
    import InboundorderReport from "./InboundorderReport";
    import OutboundOrderReport from "./OutboundOrderReport";
    import CarExpenseReport from "./CarExpenseReport";
    import GasolineRecordReport from "./GasolineRecordReport";
    import PersonnelSummary from "./PersonnelSummary";
    import AttendanceSummaryReprot from "./AttendanceSummaryReprot";

    export default {
        name: "ReportMian",
        components: {
            FinanceDetailReport, FinanceCostReport, FinanceFlowWaterReport, PersonLoanSumReport,
            ProjectCollectionReport, ProjectExpensesReport, ProjectLaborExpensesReport, ProjectGrossProfitReport,
            ApplyPurchaseReport, PurchaseOrderReport, InboundorderReport, OutboundOrderReport, CarExpenseReport,
            GasolineRecordReport, PersonnelSummary, AttendanceSummaryReprot,
        },
        data() {
            return {
                AllProject: [],
                AllDepartment: [],
                AllCustomer: [],
                AllContractType: [],
                AllFinanceBankCard: [],
                AllDeviceCategory: [],
                AllVehicle: [],
                activeNames: ['1', '2', '3', '4', '5'],
                FinanceDetailReport_dialog: false,
                FinanceCostReport_dialog: false,
                FinanceFlowWaterReport_dialog: false,
                PersonLoanSumReport_dialog: false,
                ProjectCollectionReport_dialog: false,
                ProjectExpensesReport_dialog: false,
                ProjectLaborExpensesReport_dialog: false,
                ProjectGrossProfitReport_dialog: false,
                ApplyPurchaseReport_dialog: false,
                PurchaseOrderReport_dialog: false,
                InboundorderReport_dialog: false,
                OutboundOrderReport_dialog: false,
                CarExpenseReport_dialog: false,
                GasolineRecordReport_dialog: false,
                AttendanceSummaryReprot_dialog: false,
                PersonnelSummary_dialog: false,
            }
        },
        created() {
            this.init()
        },
        methods: {
            //初始数据加载
            init() {
                this.AllProject = publicjs.GetAllProject(this.$http)
                this.AllDepartment = publicjs.GetAllDepartment(this.$http)
                this.AllCustomer = publicjs.GetAllCustomer(this.$http)
                this.AllContractType = publicjs.GetAllContractType(this.$http)
                this.AllFinanceBankCard = publicjs.GetAllFinanceBankCard(this.$http)
                this.AllDeviceCategory = publicjs.GetAllDeviceCategory(this.$http)
                this.AllVehicle = publicjs.GetAllVehicle(this.$http)
            },
            onDialog(key) {
                this[key] = true;
                let reportMianShow = window.parent.document.getElementsByClassName("reportMianShow");
                for (let i = 0; i < reportMianShow.length; i++) {
                    reportMianShow[i].style.display = "none";
                }
            },
            async onClose(done){
                await done();
                let reportMianShow = window.parent.document.getElementsByClassName("reportMianShow");
                for (let i = 0; i < reportMianShow.length; i++) {
                    reportMianShow[i].style.display = "inline-block";
                }
            },
        }
    }
</script>

<style scoped>
    .divstyle {
        padding: 0px 20px;
    }
</style>
